﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using MrDev.GameObjects;

namespace MrDev.Physics
{
    class PhysicsParameters
    {
        public Rectangle? RelativeCollisionRect;
        public float MoveAcceleration = 14000.0f;
        public float MaxMoveSpeed = 2000.0f;
        public float GroundDragFactor = 0.58f;
        public float AirDragFactor = 0.65f;
        public float JumpVelocity = -1100f;
        public float GravityAcceleration = 3500.0f;
        public float MaxFallSpeed = 1200.0f;
        public float Movement;
        public float FaceDirection = 1;
        public bool IsOnGround;
        public bool IsJumping;
        public Vector2 Position;
        public Vector2 PreviousPosition;
        public Vector2 Velocity;
        public Rectangle PreviousBounds;
        public Rectangle SpriteSize;

        public static PhysicsParameters CreatePlayerParameters()
        {
            PhysicsParameters p = new PhysicsParameters()
            {
                MoveAcceleration = 14000.0f,
                MaxMoveSpeed = 2000.0f,
                GroundDragFactor = 0.58f,
                AirDragFactor = 0.65f,
                JumpVelocity = -1100f,
                GravityAcceleration = 3500.0f,
                MaxFallSpeed = 1200.0f
            };

            return p;
        }

        public static PhysicsParameters CreateExplosionParameters()
        {
            PhysicsParameters p = new PhysicsParameters()
            {
                GroundDragFactor = 0.58f,
                AirDragFactor = 0.65f,
                GravityAcceleration = 0
            };

            return p;
        }

        public static PhysicsParameters CreateBoss1Parameters()
        {
            PhysicsParameters p = new PhysicsParameters()
            {
                MoveAcceleration = 14000.0f,
                MaxMoveSpeed = 2000.0f,
                GroundDragFactor = 0.58f,
                AirDragFactor = 0.65f,
                JumpVelocity = -1100f,
                GravityAcceleration = 3500.0f,
                MaxFallSpeed = 1200.0f,
                IsOnGround = true
            };

            return p;
        }

        public static PhysicsParameters CreateEnemyParameters()
        {
            PhysicsParameters p = new PhysicsParameters()
            {
                MoveAcceleration = 8000.0f,
                MaxMoveSpeed = 2000.0f,
                GroundDragFactor = 0.58f,
                AirDragFactor = 0.65f,
                JumpVelocity = -1100f,
                GravityAcceleration = 3500.0f,
                MaxFallSpeed = 1200.0f,                 
            };

            return p;
        }

        public static PhysicsParameters CreateBulletParameters()
        {
            PhysicsParameters p = new PhysicsParameters()
            {
                MoveAcceleration = 0.0f,
                MaxMoveSpeed = 6000.0f,
                GroundDragFactor = 1.00f,
                AirDragFactor = 1.00f,
                JumpVelocity = -1100f,
                GravityAcceleration = 0f,
                MaxFallSpeed = 1200.0f,
                

            };

            return p;
        }

        public Vector2 SpriteBottomCenter
        {
            get
            {
                return new Vector2(SpriteSize.Width / 2.0f, SpriteSize.Height);
            }
        }


        internal static PhysicsParameters CreatePowerupParameters()
        {
            PhysicsParameters p = new PhysicsParameters()
            {
                MoveAcceleration = 0.0f,
                MaxMoveSpeed = 6000.0f,
                GroundDragFactor = 1.00f,
                AirDragFactor = 1.00f,
                JumpVelocity = -1100f,
                GravityAcceleration = 0f,
                MaxFallSpeed = 1200.0f,


            };

            return p;
        }
    }
}
